<template>
    <div class="schooladd">
        <el-form class="form" :model="form" :rules="rules" ref="formref">
            <el-form-item prop="id" label="序号">
                <el-input  v-model="id" placeholder="输入学校序号" />
            </el-form-item>
            <el-form-item prop="name" label="名称">
                <el-input v-model="name" placeholder="输入学校名称" />
            </el-form-item>
            <el-form-item prop="phone" label="代码">
                <el-input v-model="phone" placeholder="输入学校代码" />
            </el-form-item>
            <el-form-item prop="sType" label="类型">
                <el-input v-model="sType" placeholder="输入学校类型" />
            </el-form-item>
            <el-form-item prop="sSystem" label="办别">
                <el-input  v-model="sSystem" placeholder="输入学校办别" />
            </el-form-item>
            <el-form-item prop="area" label="地区">
                <el-input v-model="area" placeholder="输入学校所属地区" />
            </el-form-item>
            <el-form-item prop="areaDetail" label="地址">
                <el-input v-model="areaDetail" placeholder="输入详细地址地址" />
            </el-form-item>
            <el-form-item>
                <el-button class="btn" type="primary" @click="onSubmit">添加学校
                </el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
import server from '@/api';
import { useRouter } from 'vue-router'
import { onMounted, ref } from 'vue';
import { ElNotification } from 'element-plus'
import 'element-plus/es/components/notification/style/css'

var router = useRouter()
const id = ref('')
const name = ref('')
const phone = ref('')
const sType = ref('')
const sSystem = ref('')
const area = ref('')
const areaDetail = ref('')

var form = ref({id:'',sType:'',name:'',sSystem:'',area:'',areaDetail:'',phone:''});



var onSubmit= (async () => {
    // name: any, sSystem: any, area: any, areaDetail: any, phone: any
    // console.log(id.value, name.value, phone.value, sType.value, sSystem.value, area.value);

    // // school_saveSchool
    var res = await server.xuexiaotongji.school_saveSchool({ name: name.value, phone: phone.value, sSystem: sSystem.value, area: area.value, areaDetail: areaDetail.value })
    console.log(res);
    // console.log(res);
    if (res.data.code == 200) {
        ElNotification.success({ message: "添加成功" })

        router.push('/index/xuexiaoguanli/school/minschool');
    }
})
</script>

<style></style>